
<!--header-->
<!-- 引用头部 -->
{include file="common/top"}

<!-- 引入左侧 -->
{include file="common/left"}

<section class="rt_wrap content mCustomScrollbar">
<div class="rt_content">
	<section>
      <h2><strong style="color:grey;">借款列表页面</strong></h2>
    </section>
    <table class="table">
    	<tr>
    		<td>借款人</td>
    		<td>借款金额</td>
    		<td>借款时长</td>
    		<td>审核状态</td>
    		<td>借款时间</td>
    		<td>还款方式</td>
            <td>审核</td>
    	</tr>
    	<?php foreach($UnauditedBorrow as $v){?>
    	<tr>
    		<td><?= $v['realName']?></td>
    		<td class="repayMoney"><?= $v['repayMoney']?></td>
    		<td><?= $v['long']?></td>
    		<td><?= $v['repayStatus']?></td>
    		<td><?= $v['time']?></td>
    		<td><?= $v['repayment']?></td>
            <td>
                <input type="hidden" value="<?= $v['userId']?>">
                <select class="audit" name="" id="<?= $v['bid']?>">
                    <option value="0">--审核--</option>
                    <option value="2">审核通过</option>
                    <option value="3">审核未通过</option>
                </select>
            </td>
    	</tr>
    	<?php }?>
    </table>
</div>
</section>
<script>
    $(function(){
        $(document).on('change','.audit',function()
        {
            var status = $(this).val();
            var userId = $(this).prev().val();
            var repayMoney = $(this).parent().prev().prev().prev().prev().prev().html();
            var bid = $(this).prop('id');
            obj = $(this);
            $.ajax({
                url:"{:url('borrow/auditBorrow')}",
                data:{bid:bid,status:status,repayMoney:repayMoney,userId:userId},
                type:"post",
                dataType:"json",
                success:function(res)
                {
                    obj.parent().parent().remove();
                }
            })
        })
    })
</script>